package com.situ.day718.Cal;

public class Cal {
        private int num1;
        private int num2;

        //构造无参方法
        public  Cal(){
            System.out.println("Cal.Cal");
        }
        //构造方法
        public Cal(int num1,int num2){
            this.num1 = num1;
            this.num2 = num2;
        }
        //加法
    public int add(){
            return num1 + num2;
        }
        //减法
        public int sub(){
             return num1 - num2;
        }
        //乘法
        public int multi(){
           return num1 * num2;
        }
        //触发
        public String div() {
            if (num2 == 0) {
                return "错误，除数不能为0！";
            }
            return String.valueOf(num1 / num2);
        }
}
